package com.wf.netty.order;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;

/**
 * 出站
 *
 * @author wf
 * @since 2022/5/13
 */
public class EchoOutBoundHandler extends ChannelOutboundHandlerAdapter {
    private String name;
    public EchoOutBoundHandler(String name) {
        this.name = name;
    }

    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        System.out.println("out bound write: " + name);
        super.write(ctx, msg, promise);
    }

    @Override
    public void flush(ChannelHandlerContext ctx) throws Exception {
        System.out.println("out bound flush: " + name);
        super.flush(ctx);
    }
}
